<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			'use strict'
			function chef(foods){
				let i = 0;
				return {
					next(){
						let done = (i >= foods.length);
						let value = !done ? foods[i++] : undefined;
						return {
							value,
							done
						}
					}
				}
			}
			let wanghao = chef(['w','a','n']);
			console.log(wanghao.next());
			console.log(wanghao.next());			
			console.log(wanghao.next());	
			console.log(wanghao.next());
		</script>
	</body>
</html>
